<template>
	<view class="wrap">
		<view class="modItem">
			<view class="modTit spec">{{orderInfo.content}}</view>
			<view class="modCon">
				<view class="innerCon">
					<view class="conItem">
						<text class="tit">会员期限</text>
						<text>{{orderInfo.startDate}}至{{orderInfo.endDate}}</text>
					</view>
					<view class="conItem">
						<text class="tit">价格</text>
						<text>¥{{orderInfo.money}}</text>
					</view>
				</view>
				<view class="priceWrap spaceBet">
					<view v-if="orderInfo.status == 2">实付</view>
					<view v-else>应付</view>
					<view class="price">¥{{orderInfo.money}}</view>
				</view>
			</view>
		</view>
		<view class="modItem">
			<view class="modTit">订单信息</view>
			<view class="modCon">
				<view class="conItem">
					<text class="tit">订单编号</text>
					<text>SN52121259853</text>
				</view>
				<view class="conItem">
					<text class="tit">下单时间</text>
					<text>{{orderInfo.orderNoLocal}}</text>
				</view>
				<view class="conItem">
					<text class="tit">订单状态</text>
					<text class="waitPay" v-if="orderInfo.status == 0">待付款</text>
					<text v-if="orderInfo.status == 1">已取消</text>
					<text class="hasComp" v-if="orderInfo.status == 2">已付款</text>
				</view>
				<view class="conItem" v-if="orderInfo.payAccount != ''">
					<text class="tit">支付方式</text>
					<text>{{orderInfo.payAccChi}}</text>
				</view>
				<view class="conItem">
					<text class="tit">受益人</text>
					<text>{{orderInfo.toName}}</text>
				</view>
			</view>
		</view>
		<button class="comBtn" v-if="orderInfo.status == 0" @tap="goPay">去支付</button>
	</view>
</template>

<script>
	import { getStudyBuyOrderInfo } from '@/api/zhuxue'
	export default {
		data() {
			return {
				orderId:'',
				orderInfo:{}
			}
		},
		onLoad(options){
			this.orderId = options.orderId;
			this.buyDays = options.buyDays;
			this.loadOrderDet();
		},
		methods: {
			goPay(){
				var orderInfo = this.orderInfo;
				var vipEndDate = orderInfo.startDate + '至' + orderInfo.endDate;
				uni.navigateTo({
					url:'/pages/subIndex/orderPayZx/orderPayZx?orderId=' + this.orderId + '&buyDays=' + this.buyDays + '&vipEndDate=' + vipEndDate + '&fromPage=zxOrderDet'
				})
			},
			loadOrderDet(){
				var field = { id:this.orderId };
				getStudyBuyOrderInfo(field).then(res=>{
					this.orderInfo = res.data.datas;
				}).catch(err=>{
					console.log(err)
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background: $pss-bg-primary;
	}
</style>
<style lang="scss" scoped>
	.comBtn{
		margin-top: 100rpx;
		border-radius: 50rpx;
		@include respTo(pad){
			height: 60rpx;
			line-height: 60rpx;
			font-size: $padSize18;
		}
	}
	.modItem{
		background: #fff;
		border-radius: 15rpx;
		margin-bottom: 30rpx;
	}
	.modCon{
		padding: 20rpx;
		.innerCon{
			border-bottom: 1rpx solid #eee;
			padding-bottom: 20rpx;
		}
		.priceWrap{
			align-items: center;
			color: $pss-text-color3;
			@include respTo(phone){
				height: 80rpx;
				font-size: $font-size30;
			}
			@include respTo(pad){
				height: 50rpx;
				font-size: $padSize16;
				margin-top: 10rpx;
			}
			.price{
				color: $pss-color-red;
				font-weight: bold;
				@include respTo(phone){
					font-size: $font-size32;
				}
				@include respTo(pad){
					font-size: $padSize24;
				}
			}
		}
		.conItem{
			display: flex;
			justify-content: space-between;
			@include respTo(phone){
				height: 80rpx;
				line-height: 80rpx;
				font-size: $font-size28;
			}
			@include respTo(pad){
				height: 50rpx;
				line-height: 50rpx;
				font-size: $padSize16;
			}
			.waitPay{
				color: $pss-color-red;
			}
			.hasComp{
				color: $pss-color-green;
			}
			.tit{
				color: $pss-text-colora;
			}
		}
	}
	.modTit{
		color: $pss-text-color3;
		padding: 0 20rpx;
		font-weight: bold;
		box-shadow: 0 5rpx 8rpx rgba(0,0,0,.02);
		@include respTo(phone){
			height: 90rpx;
			line-height: 90rpx;
			font-size: $font-size32;
		}
		@include respTo(pad){
			height: 70rpx;
			line-height: 70rpx;
			font-size: $padSize20;
		}
		&.spec{
			color: #ffba00;
			@include respTo(phone){
				font-size: $font-size34;
			}
			@include respTo(pad){
				font-size: $padSize22;
			}
		}
	}
	.wrap{
		padding: 30rpx 30rpx 0;
	}
</style>
